package com.atguigu.lease.common.exception;

import com.atguigu.lease.model.enums.UserExistEnum;
import lombok.Data;

/**
 * @Author：yyj
 * @Package：com.atguigu.lease.common.exception
 * @Project：project01
 * @name：UserExist
 * @Date：2024/11/20 20:55
 * @Filename：UserExist
 */

@Data
public class UserExist extends RuntimeException{
    private Integer code;
    private String message;

    public UserExist(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public UserExist(UserExistEnum userExistEnum){
        this.code = userExistEnum.getCode();
        this.message = userExistEnum.getMessage();
    }


    @Override
    public String toString() {
        return "LeaseException{" +
                "code=" + code +
                ", message=" + this.getMessage() +
                '}';
    }

}
